package com.xinqi.modules.discuss.discuss.job;

import com.xinqi.common.base.utils.uuids.UUIDs;
import com.xinqi.modules.discuss.discuss.service.CourseDiscussService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class DiscussJob {
    private final CourseDiscussService courseDiscussService;

    /**
     * 讨论 -- 定时发布
     *
     * @throws Exception
     */
    @XxlJob("releaseDiscuss")
    public ReturnT<String> releaseDiscuss() throws Exception {
        String uid = UUIDs.uuidStr();
        log.debug("job executor! {}, 定时发布讨论-开始", uid);
        courseDiscussService.releaseDiscuss();
        log.debug("job executor! {}, 定时发布讨论-结束", uid);
        return ReturnT.SUCCESS;
    }

}
